Skip to content

Conversation

@nayonsoso
Copy link
Collaborator

@nayonsoso nayonsoso commented Aug 1, 2025

관련 이슈

작업 내용

커밋을 따라 읽어주세요~
PR분량이 많고, 순도 100%의 코드리뷰도 하지 않으므로 이번에는 PR 디스크립션을 꼼꼼히 작성해보겠습니다🫡

  • 532df89
    • 컨트롤러를 어떻게 구성할지 정말 고민이 많았는데요, 컨트롤러는 "역할별"로 나누어도 괜찮을 것이라는 판단하에, MentoringForMenteeController와 MentoringForMentorController로 나누어 구성했습니다.
  • 4175a9f
    • N+1 문제를 해결하면서, 멘토는 멘티의 프로필, 멘티는 멘토의 프로필을. 즉 '상대방의 프로필'을 가지고오는 코드를 작성했습니다.
    • 이를 중복 코드 최소한으로 줄이기 위해 함수형 인터페이스를 사용했습니다.
  • 787de59
    • 기존 멘토링 조회 테스트코드에 '페이지네이션'을 적용했습니다.
    • 이 커밋에서의 특이사항은, "mentor 테이블에 mentor_id, mentee_id UNIQUE 제약이 걸릴 것을 대비"하여 변수 설정 바꿨다는 점입니다~
  • 5811329
    • 멘토링 체크 로직을 별도의 서비스로 분리했습니다.
    • 이로서 멘토링과 관련된 서비스는 MentoringCheckService, MentoringCommandService, MentoringQueryService 이렇게 세가지가 되었습니다. 이 지점에서 "🤔컨트롤러는 역할별로 나눴으면서, 서비스는 기능별로 나누었네?" 라는 의문이 드실 수 있으실텐데요. 지금의 프로젝트에서는 권한 관련 어노테이션이 컨트롤러에 있기 때문에 컨트로러는 권한별로 나누어도 괜찮지만, 서비스 코드는 기능별로 관리하는게 응집도도 있고, 공통되는 코드를 관리하기도 쉬울것이라고 생각했습니다. (e.g. check 에 대해서, 멘토와 멘티 서비스에 각각 있다면 private 함수를 재사용하지 못할 것)
  • 62a5152
    • "멘티의 확인 시간" 컬럼을 테이블에 추가했습니다.
    • flyway 스크립트도 문제 없이 작성했습니다😁
  • dea2714
    • 멘토/멘티의 멘토링 확인 기능을 구현했습니다.
    • 그리고 멘토링 목록 조회에서 각자의 확인 여부를 포함하여 응답하게 했습니다.
  • abe76d0
    • 이 부분은 제 해석이 들어간 부분입니다만.. 멘토가 멘토링을 승인하면, 멘티의 확인 여부를 초기화하게 했습니다. 승인이 되면, 새롭게 확인해야한다고 생각했습니다!
  • 09ee5b3
    • 기획상 거절된 멘토링 목록은 보여주지 않기로 되어있어서, 해당 내용을 구현했습니다.

특이 사항

오늘(토요일)까지 머지하겠습니다. 🏃‍♀️🏃‍♀️

@coderabbitai
Copy link

coderabbitai bot commented Aug 1, 2025

Warning

Rate limit exceeded

@nayonsoso has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between f94d8c3 and 09ee5b3.

📒 Files selected for processing (11)
  • src/main/java/com/example/solidconnection/mentor/controller/MentoringForMenteeController.java (1 hunks)
  • src/main/java/com/example/solidconnection/mentor/controller/MentoringForMentorController.java (3 hunks)
  • src/main/java/com/example/solidconnection/mentor/domain/Mentoring.java (2 hunks)
  • src/main/java/com/example/solidconnection/mentor/dto/MentoringForMenteeResponse.java (1 hunks)
  • src/main/java/com/example/solidconnection/mentor/dto/MentoringForMentorResponse.java (1 hunks)
  • src/main/java/com/example/solidconnection/mentor/dto/MentoringListResponse.java (0 hunks)
  • src/main/java/com/example/solidconnection/mentor/service/MentoringCheckService.java (1 hunks)
  • src/main/java/com/example/solidconnection/mentor/service/MentoringQueryService.java (2 hunks)
  • src/test/java/com/example/solidconnection/mentor/service/MentoringCheckServiceTest.java (1 hunks)
  • src/test/java/com/example/solidconnection/mentor/service/MentoringCommandServiceTest.java (2 hunks)
  • src/test/java/com/example/solidconnection/mentor/service/MentoringQueryServiceTest.java (3 hunks)

Walkthrough

  1. 신규 기능 및 구조 변경

    • 멘티 전용 REST 컨트롤러(MentoringForMenteeController)가 추가되어 멘토링 신청, 목록 조회, 확인 기능을 분리하였습니다.
    • 기존 멘토링 컨트롤러는 MentoringForMentorController로 이름이 변경되고, 멘토 전용 엔드포인트로 리팩토링되었습니다.
  2. 도메인 및 DTO 구조 개선

    • Mentoring 엔티티의 checkedAt 필드가 checkedAtByMentor, checkedAtByMentee로 분리되어 멘토와 멘티의 확인 시점을 각각 관리합니다.
    • 멘토와 멘티의 시각에서 각각 다른 응답 DTO(MentoringForMentorResponse, MentoringForMenteeResponse)를 사용하도록 변경되었습니다.
    • 멘토링 확인 요청/응답용 DTO(CheckMentoringRequest, CheckedMentoringsResponse)가 새로 도입되었습니다.
  3. 서비스 계층 분리 및 기능 확장

    • 멘토링 확인 관련 로직이 MentoringCheckService로 분리되어 멘토·멘티 각각의 확인 처리와 소유권 검증, 미확인 멘토링 개수 조회 기능을 담당합니다.
    • 멘토링 목록 조회 서비스도 멘토/멘티별로 분리되고, N+1 문제를 방지하기 위해 파트너 유저 일괄 조회 로직이 추가되었습니다.
  4. 저장소 및 쿼리 개선

    • MentoringRepository가 멘토·멘티별 상태 기반 슬라이스 조회, 확인 여부 기반 카운트 쿼리 등으로 확장 및 변경되었습니다.
    • 데이터베이스 마이그레이션을 통해 checked_at 컬럼이 checked_at_by_mentor로 이름이 바뀌고, checked_at_by_mentee 컬럼이 추가되었습니다.
  5. 테스트 코드 리팩토링 및 보강

    • 멘토링 확인 서비스(MentoringCheckService)에 대한 단위 테스트가 새로 작성되었습니다.
    • 기존 커맨드/쿼리 서비스 테스트는 새로운 구조와 DTO에 맞게 리팩토링되고, 예외 처리 및 소유권 검증 케이스가 추가되었습니다.
    • 테스트 픽스처도 새로운 필드 구조에 맞게 수정되었습니다.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40–60 minutes

  • 복수의 신규 컨트롤러, 서비스, DTO, 저장소 메서드 및 마이그레이션이 포함되어 있습니다.
  • 도메인 구조의 변경이 전체 기능 흐름에 영향을 주므로, 테스트 코드와 실제 서비스 코드의 상호작용을 꼼꼼히 검토해야 합니다.
  • 테스트 코드 리팩토링 및 신규 테스트 추가로 인해 검증 범위가 넓어졌습니다.

Suggested reviewers

  • Gyuhyeok99
  • wibaek
  • whqtker
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@nayonsoso nayonsoso force-pushed the refactor/419-adjust-changed-api branch from 67ce1d3 to f94d8c3 Compare August 1, 2025 17:51
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/test/java/com/example/solidconnection/mentor/service/MentoringQueryServiceTest.java (1)

57-57: mentorUser3 변수 선언 일관성 확인 필요

mentorUser3만 로컬 변수로 선언되어 있는데, 다른 사용자들처럼 인스턴스 필드로 선언하는 것이 일관성 있을 것 같습니다. 테스트에서 사용하지 않는다면 생성하지 않는 것도 고려해보세요.

-        SiteUser mentorUser3 = siteUserFixture.멘토(3, "mentor3");
+        SiteUser mentorUser3 = siteUserFixture.멘토(3, "mentor3");

그리고 필드 선언부에 추가:

-    private SiteUser mentorUser1, mentorUser2;
+    private SiteUser mentorUser1, mentorUser2, mentorUser3;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 67ce1d3 and f94d8c3.

📒 Files selected for processing (18)
  • src/main/java/com/example/solidconnection/mentor/controller/MentoringForMenteeController.java (1 hunks)
  • src/main/java/com/example/solidconnection/mentor/controller/MentoringForMentorController.java (3 hunks)
  • src/main/java/com/example/solidconnection/mentor/domain/Mentoring.java (2 hunks)
  • src/main/java/com/example/solidconnection/mentor/dto/CheckMentoringRequest.java (1 hunks)
  • src/main/java/com/example/solidconnection/mentor/dto/CheckedMentoringsResponse.java (1 hunks)
  • src/main/java/com/example/solidconnection/mentor/dto/MentoringForMenteeResponse.java (1 hunks)
  • src/main/java/com/example/solidconnection/mentor/dto/MentoringForMentorResponse.java (1 hunks)
  • src/main/java/com/example/solidconnection/mentor/dto/MentoringListResponse.java (0 hunks)
  • src/main/java/com/example/solidconnection/mentor/repository/MentoringRepository.java (1 hunks)
  • src/main/java/com/example/solidconnection/mentor/service/MentoringCheckService.java (1 hunks)
  • src/main/java/com/example/solidconnection/mentor/service/MentoringCommandService.java (0 hunks)
  • src/main/java/com/example/solidconnection/mentor/service/MentoringQueryService.java (2 hunks)
  • src/main/resources/db/migration/V27__add_checked_at_by_mentee_column.sql (1 hunks)
  • src/test/java/com/example/solidconnection/mentor/fixture/MentoringFixture.java (2 hunks)
  • src/test/java/com/example/solidconnection/mentor/fixture/MentoringFixtureBuilder.java (3 hunks)
  • src/test/java/com/example/solidconnection/mentor/service/MentoringCheckServiceTest.java (1 hunks)
  • src/test/java/com/example/solidconnection/mentor/service/MentoringCommandServiceTest.java (2 hunks)
  • src/test/java/com/example/solidconnection/mentor/service/MentoringQueryServiceTest.java (3 hunks)
💤 Files with no reviewable changes (2)
  • src/main/java/com/example/solidconnection/mentor/service/MentoringCommandService.java
  • src/main/java/com/example/solidconnection/mentor/dto/MentoringListResponse.java
🚧 Files skipped from review as they are similar to previous changes (15)
  • src/main/java/com/example/solidconnection/mentor/dto/CheckMentoringRequest.java
  • src/main/resources/db/migration/V27__add_checked_at_by_mentee_column.sql
  • src/test/java/com/example/solidconnection/mentor/fixture/MentoringFixture.java
  • src/main/java/com/example/solidconnection/mentor/domain/Mentoring.java
  • src/main/java/com/example/solidconnection/mentor/dto/CheckedMentoringsResponse.java
  • src/main/java/com/example/solidconnection/mentor/service/MentoringCheckService.java
  • src/test/java/com/example/solidconnection/mentor/service/MentoringCheckServiceTest.java
  • src/main/java/com/example/solidconnection/mentor/dto/MentoringForMenteeResponse.java
  • src/test/java/com/example/solidconnection/mentor/service/MentoringCommandServiceTest.java
  • src/main/java/com/example/solidconnection/mentor/dto/MentoringForMentorResponse.java
  • src/main/java/com/example/solidconnection/mentor/service/MentoringQueryService.java
  • src/main/java/com/example/solidconnection/mentor/repository/MentoringRepository.java
  • src/test/java/com/example/solidconnection/mentor/fixture/MentoringFixtureBuilder.java
  • src/main/java/com/example/solidconnection/mentor/controller/MentoringForMenteeController.java
  • src/main/java/com/example/solidconnection/mentor/controller/MentoringForMentorController.java
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: nayonsoso
PR: solid-connection/solid-connect-server#375
File: src/main/java/com/example/solidconnection/mentor/service/MentorMyPageService.java:47-53
Timestamp: 2025-07-05T17:54:42.475Z
Learning: MentorMyPageService에서 PUT 메서드 구현 시 전체 채널을 새로 생성하여 교체하는 방식을 사용하는 것이 PUT의 의미론적 특성과 일치하며, 트랜잭션 로킹 관점에서도 합리적인 접근이다.
Learnt from: whqtker
PR: solid-connection/solid-connect-server#362
File: src/main/java/com/example/solidconnection/mentor/service/MentoringQueryService.java:0-0
Timestamp: 2025-07-04T10:41:32.999Z
Learning: 멘토링 관련 기능에는 페이지네이션을 적용하지 않는 것이 해당 프로젝트의 설계 방침이다.
📚 Learning: 멘토링 조회 기능에는 페이지네이션을 적용하지 않는 것이 요구사항입니다. 멘토링 데이터의 특성상 대량 데이터 처리가 필요하지 않을 것으로 예상됩니다....
Learnt from: whqtker
PR: solid-connection/solid-connect-server#362
File: src/main/java/com/example/solidconnection/mentor/service/MentoringQueryService.java:0-0
Timestamp: 2025-07-04T10:41:20.575Z
Learning: 멘토링 조회 기능에는 페이지네이션을 적용하지 않는 것이 요구사항입니다. 멘토링 데이터의 특성상 대량 데이터 처리가 필요하지 않을 것으로 예상됩니다.

Applied to files:

  • src/test/java/com/example/solidconnection/mentor/service/MentoringQueryServiceTest.java
🧬 Code Graph Analysis (1)
src/test/java/com/example/solidconnection/mentor/service/MentoringQueryServiceTest.java (2)
src/test/java/com/example/solidconnection/mentor/service/MentoringCommandServiceTest.java (2)
  • Nested (70-90)
  • Nested (92-175)
src/test/java/com/example/solidconnection/mentor/service/MentoringCheckServiceTest.java (3)
  • Nested (64-101)
  • Nested (103-170)
  • Nested (141-169)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (4)
src/test/java/com/example/solidconnection/mentor/service/MentoringQueryServiceTest.java (4)

4-27: 임포트 추가가 적절합니다!

새로운 페이지네이션 기능과 역할별 응답 DTO를 지원하기 위한 필수 임포트들이 잘 추가되었네요.


68-132: 멘토 테스트가 명세 변경사항을 잘 반영합니다!

변경된 API 명세에 따라:

  1. 모든 상태의 멘토링을 조회하는 테스트
  2. 상대방(멘티) 정보 포함 여부 확인
  3. 멘토의 확인 여부(isChecked) 검증
  4. 빈 리스트 처리

모든 케이스가 잘 커버되어 있습니다.


135-234: 멘티 테스트가 역할별 요구사항을 잘 구현했습니다!

변경된 명세에 따른 주요 검증 사항:

  1. 거절된 멘토링 조회 시 예외 발생 ✓
  2. 상태별(승인/대기) 필터링 ✓
  3. 상대방(멘토) 정보 포함 ✓
  4. 멘티의 확인 여부(isChecked) 검증 ✓
  5. 빈 리스트 처리 ✓

모든 시나리오가 적절히 테스트되고 있습니다.


26-27: 페이지네이션 적용이 프로젝트 방침과 일치하는지 확인 필요

이전 학습 내용에 따르면 멘토링 기능에는 페이지네이션을 적용하지 않는 것이 프로젝트 방침이었습니다. 하지만 이번 리팩토링에서 PageableSliceResponse를 사용하고 있네요.

명세 변경으로 인한 의도적인 변경인지 확인이 필요합니다.

Also applies to: 51-51, 64-64

@nayonsoso nayonsoso force-pushed the refactor/419-adjust-changed-api branch from f94d8c3 to 09ee5b3 Compare August 1, 2025 18:16
Copy link
Member

@whqtker whqtker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

일단 approve하고 천천히 보겠습니다 !

@nayonsoso nayonsoso merged commit fd60791 into solid-connection:develop Aug 2, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: 멘토/멘티 탭의 api 명세 변경을 적용한다.

2 participants